﻿using System;
using System.Runtime.Serialization;
using System.ComponentModel;
using nRoute.Components;

namespace nRoute.Samples.Sudoku.Model
{
    public class Box : INotifyPropertyChanged, IEquatable<Box>
    {
        private BoxValue _suggestedValue;

        [DataMember]
        public int Row { get; set; }

        [DataMember]
        public int Col { get; set; }

        [DataMember]
        public bool IsPreDefined { get; set; }

        [DataMember]
        public BoxValue SuggestedValue
        {
            get { return _suggestedValue; }
            set
            {
                if (_suggestedValue != value)
                {
                    _suggestedValue = value;
                    PropertyChanged.Notify(() => SuggestedValue);
                }
            }
        }

        [DataMember]
        public BoxValue ExpectedValue { get; set; }

#region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

#endregion

#region IEquatable<Box> Members

        public bool Equals(Box other)
        {
            return (this.Col == other.Col && this.Row == other.Row); 
        }

#endregion

    }
}
